package day06;

import java.util.Arrays;

public class MaxOfArray2 {
    public static void main(String[] args) {
        int[] a = new int[6];
        for (int b= 0;b<a.length;b++){
            a[b] =(int)(Math.random()*100);
            System.out.println(a[b]);
        }
        int max = a[0];
        for (int c = 1;c<a.length;c++){
            if (a[c]>max){
                max =a[c];
            }
        }
        System.out.println("最大值为:"+max);
        a= Arrays.copyOf(a,a.length+1);
        a[a.length-1]=max;
        for (int d = 0;d<a.length;d++){
            System.out.println(a[d]);
        }

    }
}
